﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="HeadStyles" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadScripts" runat="server">
<script type="text/javascript" src="/Scripts/formvalidator/formValidator-4.1.1.js"></script>
<script type="text/javascript" src="/Scripts/formvalidator/formValidatorRegex.js"></script>
<script type="text/javascript" src="/Scripts/m-former.js"></script>    
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
  <% AdminUserModel AdminUser = ViewData["AdminUser"] as AdminUserModel; %>
<div class="pd10">
    <form id="form1" action="save" method="post">
		<table class="tb-list mt10">
			<tr>
				<td class="aR" style="width:25%;">*用戶名：</td>
				<td class="aL" style="width:35%;">
				    <input type="text" id="txtUserName" name="txtUserName" value="" class="inputStyle"/>
                    
				</td>
                 <td  class="aL" style="width:40%;">
                    <div id="txtUserNameTip"></div>
                 </td>
			</tr>
            <tr>
				<td class="aR">*密码：</td>
				<td class="aL">
				    <input type="password" id="txtPassword" name="txtPassword" value="" class="inputStyle" />
				</td>
                <td class="aL">
                <div id="txtPasswordTip"></div>
                </td>
			</tr>
            <tr>
				<td class="aR">*重复密码：</td>
				<td class="aL">
				    <input type="password" id="txtPassword2" name="txtPassword2" value="" class="inputStyle" />
				</td>
                <td class="aL">
                 <div id="txtPassword2Tip"></div>
                </td>
			</tr>
            <tr>
				<td class="aR">*姓名 ：</td>
				<td class="aL">
				    <input type="text" id="txtTrueName" name="txtTrueName" value="" class="inputStyle"  />
				</td>
                <td class="aL">
                <div id="txtTrueNameTip"></div>
                </td>
			</tr>
                <tr>
				<td class="aR">*邮箱 ：</td>
				<td class="aL">
				    <input type="text" id="txtEMail" name="txtEMail" value="" class="inputStyle"  />
				</td>
                <td class="aL">
                <div id="txtEMailTip"></div>
                </td>
			</tr>
            <tr>
				<td class="aR">*电话 ：</td>
				<td class="aL">
				    <input type="text" id="txtTelephone" name="txtTelephone" value="" class="inputStyle"  />
				</td>
                 <td class="aL">
                <div id="txtTelephoneTip"></div>
                </td>
			</tr>
            <tr>
				<td class="aR">*所属部门：</td>
				<td class="aL"><select id="sltOrg" name="sltOrg">
                        <% IList<OrganizationModel> OrganizationList = ViewData["OrganizationList"] as List<OrganizationModel>; %>
						<%foreach (OrganizationModel c in OrganizationList)%>
						<%{%>
						<option value="<%=c.OrgID %>"><%=c.OrgName%></option>
						<%}%>
				   </select></td>
                   <td class="aL">
                    <div id="sltOrgTip"></div>
                   </td>
			</tr>
            </tr>
                <tr>
				<td class="aR">*备注 ：</td>
				<td class="aL">
                    <textarea id="txtMemo" name="txtMemo" cols="20" rows="5"  style="width:150px"></textarea>
				</td>
                  <td class="aL">
                <div id="txtMemoTip"></div>
                </td>
			</tr>
			
		</table>
	    <div class="mt10 aC"> 
            <input id="subbtn" type="submit" value="保存" class="i-btn3"/>
            <input type="button" value="取消" onclick="cancel();" class="i-btn3"/>
	    </div>

    </form>
</div>

</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="BodyScripts" runat="server">
<script type="text/javascript">
    $(document).ready(function () {
        $.formValidator.initConfig({ formID: "form1", theme: "SolidBox", submitOnce: true,
            onError: function (msg, obj, errorlist) {
                $("#errorlist").empty();
                $.map(errorlist, function (msg) {
                    $("#errorlist").append("<li>" + msg + "</li>")
                });
                alert(msg);
            },
            ajaxPrompt: '正在异步验证，请稍等...'
        });
        $("#txtUserName").formValidator({ onShow: "请输入用户名", onFocus: "至少4个长度", onCorrect: "正确" }).inputValidator({ min: 6, max: 16, onError: "长度非法" }).regexValidator({ regExp: "username", dataType: "enum", onError: "格式不正确 " })
        .ajaxValidator({
            dataType: "html",
            async: true,
            url: "/AdminUser/CheckUserName",
            success: function (data) {
                if (data == "0") return true;
                return "用户名已存在";
            },
            buttons: $("#button"),
            error: function (jqXHR, textStatus, errorThrown) { alert("错误请重试" + errorThrown); },
            onError: "该用户名不可用，请更换用户名",
            onWait: "正在检测重复"
        });
        $("#txtTrueName").formValidator({ onShow: "请输入真实姓名", onFocus: "姓名4-12个字符", onCorrect: "正确" }).inputValidator({ min: 4, max: 8, onError: "长度非法" });
        $("#txtEMail").formValidator({ onShow: "请输入邮箱", onFocus: "邮箱6-100个字符", onCorrect: "正确", defaultValue: "@" }).inputValidator({ min: 2, max: 100, onError: "长度非法" });
        $("#txtTelephone").formValidator({ onShow: "请输入电话号码", onFocus: "电话6-100个字符", onCorrect: "正确" }).inputValidator({ min: 6, max: 100, onError: "长度非法" });
        $("#txtMemo").formValidator({ onShow: "请输入备注", onFocus: "备注0-100个字符", onCorrect: "正确" }).inputValidator({ min: 0, max: 100, onError: "长度非法" });
        $("#txtPassword").formValidator({ onShow: "请输入密码", onFocus: "至少1个长度", onCorrect: "密码合法" }).inputValidator({ min: 1, empty: { leftEmpty: false, rightEmpty: false, emptyError: "密码两边不能有空符号" }, onError: "密码不能为空" });
        $("#txtPassword2").formValidator({ onShow: "输再次输入密码", onFocus: "至少1个长度", onCorrect: "密码一致" }).inputValidator({ min: 1, empty: { leftEmpty: false, rightEmpty: false, emptyError: "重复密码两边不能有空符号" }, onError: "密码不能为空" }).compareValidator({ desID: "txtPassword", operateor: "=", onError: "2次密码不一致,请确认" });
        $("#sltOrg").formValidator({ onShow: "请选择所属部门", onFocus: "部门必须选择", onCorrect: "正确" }).inputValidator({ min: 1, onError: "请选择部门!" }).defaultPassed();

    });

    function cancel() {
        window.top.oDG.cancel();
    };

    function successHandle() {
        window.top.winObj.refresh();
        window.top.oDG.cancel();
    };
</script>
</asp:Content>
